
package feesmodule.converter;

import feesmodule.domain.Jurisdiction;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

@XmlRootElement(name = "jurisdiction")
public class JurisdictionConverter
{
    private Jurisdiction item;
    private List<JurisdictionServicesConverter> services;
    private int level = 0;

    public JurisdictionConverter(Jurisdiction jurisdiction)
    {
        this.item = jurisdiction;
    }
    public JurisdictionConverter()
    {
    }

    @XmlAttribute
    public int getId()
    {
        return item.getId();
    }
    @XmlElement
    public String getName()
    {
        return item.getName();
    }
    @XmlElement(name="services")
    public JurisdictionServicesConverter getServices()
    {
        if(level <1 )
            return null;

        return new JurisdictionServicesConverter(item.getServiceMapping());

    }

    /**
     * @return the level
     */
    @XmlTransient
    public int getLevel() {
        return level;
    }

    /**
     * @param level the level to set
     */
    public void setLevel(int level) {
        this.level = level;
    }
    
}
